package org.blade.personal.dao.base;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.blade.personal.utils.Pager;


/**
 * 
 * @author blade
 *
 * @param <T>
 * @param <ID>
 */
public interface Dao<T, ID extends Serializable> {

	/** 
	 * 
	 * @param entity
	 */
	public void add(T entity);

	/**
	 * 
	 * @param entities
	 */
	public void add(List<T> entities);

	/**
	 * 
	 * @param entity
	 */
	public void update(T entity);

	/**
	 * 
	 * @param entities
	 */
	public void update(List<T> entities);

	/**
	 * 
	 * @param entity
	 */
	public void delete(T entity);

	/**
	 * 
	 * @param id
	 */
	public void deleteById(ID id);

	/**
	 * 
	 * @param entities
	 */
	public void delete(List<T> entities);
	
	/**
	 * 
	 * @param entity
	 */
	public List<T> queryForList(T entity);
	
	/**
	 * 
	 * @param id
	 */
	public T getById(ID id);
	
	/**
	 * 
	 * @return
	 */
	public abstract List<T> queryForList();
	
	/**
	 * 
	 * @param pager
	 * @param entity
	 */
	public abstract void pagination(Pager<T> pager, T entity);
	
	/**
	 * 
	 * @param pageSize
	 * @param pageNum
	 * @param entity
	 * @return
	 */
	public abstract Pager<T> pagination(int pageSize, int pageNum , T entity);
	
	/**
	 * 
	 * @param pageSize
	 * @param pageNum
	 * @param param
	 * @return
	 */
	public abstract Pager<T> pagination(String sql,int pageSize, int pageNum , Map<String,Object> param );

}
